<template>
  <div>
    <van-nav-bar
      title="我的好友"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="friendsList">
      <div v-for="item in myFriends" :key="item">
        <div class="box">
          <img :src="item.user_face" alt="" width="40px" />
          <div>{{ item.user_name }}</div>
          <div>{{ item.gender == "female" ? "女" : "男" }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import dycard from "../../components/dyCard";
import axios from "axios";
export default {
  components: {},
  data() {
    return {
      myFriends: [],
    };
  },
  created() {
    this.getFriends();
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    getFriends() {
      axios.get("http://localhost:8888/user/findAll").then((res) => {
        console.log(res);
        this.myFriends = res.data;
      });
    },
  },
};
</script>

<style></style>
